<?php
	//make connection to server
	$link = mysql_connect('localhost', 'pott0180', 'ckersixt');
	if(!$link) {
		die('Could not connect: ' . mysql_error());
	}

	//select database
	$db_selected = mysql_select_db('soloono_roomFinder', $link);
	if (!$db_selected) {
		die('Cant use db soloono_roomFinder: ' . mysql_error());
	}

	//query : given variables key foo and baz
	$key = '6';
	$first = 'foo';
	$last = 'baz';

	//need this query to perform safe sql functions ( if from form use '$_POST[foo]' )
	$query = sprintf("INSERT INTO ***table_here*** (mykey, data, data2) VALUES ('$key', '$first', '$last')",
		mysql_real_escape_string($key),
		mysql_real_escape_string($first),
		mysql_real_escape_string($last));

	//and finally do the query
	$result = mysql_query($query);
	if(!$result){
		$message = 'Invalid query: ' . mysql_error() . "\n";
		$message = 'Whole query: ' . $query;
		die($message);
	}

	echo "Nice. You entered ".$first." and ".$last.".";

	//close connection
	mysql_close($link);
?>
